$(function(){
		/*var url = "${ctx}/admin/role/getRoler?id=${id}";
            $.getJSON(url,function(result){
                // 访问zTree方法通过数据初始化节点信息
                zTree=$.fn.zTree.init($("#menuTrees"),setting,result);
             });*/
	
	
	layui.use(['form', 'layedit', 'laydate'], function(){
		  var form = layui.form,
		  layer = layui.layer;
		 
		 //获取当前存在角色
		 $.ajax({
		    	url: "${ctx}/admin/role/getRoler", 
		      	dataType: "json",
		      	async:false,
                success: function(data){
		        	debugger;
		      	},
		      	error:function(){
		      		debugger;
		      	}
		      });
		      
		      
		 $("#roles").append(" <input type='radio' name='role' value='1' title='管理员'>");
		  
		  //自定义验证规则
		  form.verify({
		    title: function(value){
		      if(value.length < 5){
		        return '标题至少得5个字符啊';
		      }
		    },
		    pass: [/(.+){6,12}$/, '密码必须6到12位']
		  });
		  
		  //监听提交
		  form.on('submit(demo1)', function(data){
		    layer.alert(JSON.stringify(data.field), {
		      title: '最终的提交信息'
		    });
		    $.ajax({
		    	url: "user/adduser", 
		      	dataType: "json",
                data: JSON.stringify(data.field),
                success: function(){
		        	debugger;
		      	}
		      });
		    return false;
		  });
		  form.render();
		});
})